Parity union 2026-07: MCP server + parallel-blind adversarial review + fail-closed agy - #20
Merged
Conversation
…econciliation Add failures.mjs to classify CLI/transcript/job failures (rate-limit, invalid-json, stale-job, etc.) with retryable + next-step guidance, threaded through review/task execution, AGY transcript recovery, and rendered output. Job status/result queries now reconcile active jobs whose worker pid died or whose job file is corrupt, guarding against a completion race so a job that finished on disk while a stale snapshot was in flight is never clobbered back to "failed". Also fix buildEnvUnavailable inheriting the calling shell's own GEMINI_ENGINE, which made the AGY-fallback setup-label test environment-dependent.
Machine-verified on AGY 1.1.0/Windows: a fresh --engine agy --write turn with no prior workspace/project association silently writes files under ~/.gemini/antigravity-cli/scratch/ instead of cwd (status 0, no error). buildCliArgs now appends --new-project on a non-continuation write turn to bind the session's workspace to cwd; a --continue resume is left alone. Also verified AGY 1.1.0's new default request-review mode does not stall headless writes (--dangerously-skip-permissions still bypasses it, no --mode workaround needed), and documented that AGY now runs its own consumerOAuth login independent of the shared gemini CLI credential file, which getAgyLoginStatus() does not yet account for. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ents Post-commit re-verification of 0c23b99 on AGY 1.1.0/Windows: a fresh headless write turn completed in 13s (no request-review stall) with the file landing in cwd. README (EN + zh-TW) dependency row and brain-root platform notes, agyBrainRoots() inline comment, and one CHANGELOG evidence sentence. Docs/comments only, no behavior change; 216 tests pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
quoteForWindowsShell cannot reliably escape cmd.exe (embedded quotes toggle its parse state; backslash-escaping is the child's MSVCRT convention). Instead of strengthening the quoter, eliminate the shell:true + free-text-argv combo: agy now must resolve to an absolute .exe path (requireExe, mirroring companion-cx) or detectEngine throws fail-closed, so its positional prompt always spawns shell:false and never traverses cmd.exe. Also closes the .cmd-on-unpatched-Node CVE-2024-27980 angle. Quoter kept only as a no-op net for fixed-constant bare-name argv; comment/doc corrected to not claim it protects free text. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018uDUc5kSwMWqWrgsGsyYdh
Expose the existing background dispatch and job-control paths behind a hand-rolled stdio MCP server, with hermetic request tests and CLI prompt parity coverage. Constraint: No new dependencies and no duplicated prompt assembly Confidence: high Scope-risk: moderate
Dispatch prompt-identical Gemini and AGY adversarial reviews under one group id, aggregate status/results, and degrade visibly when only one requested engine is available. Constraint: Preserve v0.6.6 exports and single-engine behavior Confidence: high Scope-risk: moderate
…t; CC ledger (WP-6 r1 / D-CC1)
Blind review blocking: .mcp.json used a relative script path with cwd ".",
which resolves against the host's cwd, not the plugin dir -- so the MCP server
would fail to launch whenever the user's cwd differs from the plugin
directory (the normal case), silently un-delivering F-CC1. Every other file in
this plugin (hooks.json, commands/*.md) already uses ${CLAUDE_PLUGIN_ROOT};
.mcp.json now does too. Added tests/mcp-launch.test.mjs that spawns exactly
what .mcp.json declares from a temp cwd and requires an initialize reply --
verified it fails on the old relative form and passes on the fixed one
(the major finding: nothing previously exercised the declared launch command).
Also added docs/known-diffs.md (D-CC1) recording the two minor group-cancel /
partial-dispatch follow-ups and CC's deliberate differences.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018uDUc5kSwMWqWrgsGsyYdh
…-confirmed OAuth retired) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018uDUc5kSwMWqWrgsGsyYdh
There was a problem hiding this comment.
Pull request overview
This PR advances the “parity union” work for gemini-plugin-cc by adding an MCP server entrypoint, upgrading adversarial review to support parallel blind multi-engine dispatch (gemini+agy), and strengthening job/state handling with structured failure metadata and safer Windows spawning behavior.
Changes:
- Add a stdio MCP server (
gemini-mcp.mjs) and plugin.mcp.jsonwiring, with launch + tool-surface tests. - Implement parallel blind adversarial review via
--engines gemini,agy, including group status/result aggregation. - Introduce structured failure classification + persistence, plus atomic state/job writes and Windows “fail-closed” AGY resolution.
Reviewed changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/state.test.mjs | Adds coverage for atomic JSON writes and fail-closed corrupted job JSON reads. |
| tests/runtime.test.mjs | Adds regression tests for structured failures, multi-engine adversarial dispatch, and group aggregation in status/result. |
| tests/render.test.mjs | Verifies rendering includes structured failure metadata in status/result output. |
| tests/process.test.mjs | Adds coverage for runCommand argv handling with/without shell. |
| tests/mcp-launch.test.mjs | Ensures .mcp.json launches correctly from non-plugin cwd and responds to initialize. |
| tests/job-control.test.mjs | Covers reconciliation of stale/corrupt active jobs and structured failure persistence on runner exceptions. |
| tests/gemini-mcp.test.mjs | Validates MCP identity/tool list, delegation behavior, argument validation, and prompt parity with CLI dispatch. |
| tests/fake-gemini-fixture.mjs | Ensures tests don’t inherit developer GEMINI_ENGINE overrides when simulating engine unavailability. |
| tests/failures.test.mjs | Adds unit tests for classifyCliFailure categories and edge cases. |
| tests/engine.test.mjs | Adds coverage for AGY .exe fail-closed behavior and positional-prompt safety limits. |
| tests/agy-transcript.test.mjs | Extends transcript recovery tests to assert structured failure categories/flags. |
| README.zh-TW.md | Updates positioning/docs for Gemini→AGY transition, engine semantics, and --resume guidance. |
| README.md | Updates positioning/docs for Gemini→AGY transition, engine semantics, and --resume guidance. |
| plugins/gemini/skills/gemini-prompting/SKILL.md | Updates guidance to reflect that plugin-managed model selection is gemini-only (AGY unmanaged). |
| plugins/gemini/skills/gemini-prompting/references/gemini-prompt-recipes.md | Aligns AGY model-selection wording with current plugin behavior. |
| plugins/gemini/skills/gemini-prompting/references/gemini-prompt-blocks.md | Updates model_selection block wording for AGY semantics. |
| plugins/gemini/skills/gemini-prompting/references/gemini-prompt-antipatterns.md | Updates AGY model-selection anti-pattern docs to match current contract. |
| plugins/gemini/scripts/lib/tracked-jobs.mjs | Persists structured failure metadata on completion and exceptions. |
| plugins/gemini/scripts/lib/state.mjs | Adds atomic JSON writes and fail-closed readJobFile behavior with synthesized failure records. |
| plugins/gemini/scripts/lib/render.mjs | Renders structured failures and adds group status/result renderers. |
| plugins/gemini/scripts/lib/process.mjs | Adds Windows shell quoting helper, runCommand shell defaults, and .exe-aware resolveBinaryPath. |
| plugins/gemini/scripts/lib/model-map.mjs | Refreshes model-map metadata wording and clarifies dated probe snapshot notes. |
| plugins/gemini/scripts/lib/job-control.mjs | Adds active-job reconciliation (stale PID/corrupt job file) and group-aware snapshot/result resolution. |
| plugins/gemini/scripts/lib/gemini.mjs | Propagates structured failures, improves no-output handling, and updates AGY model-selection messaging. |
| plugins/gemini/scripts/lib/failures.mjs | Introduces canonical failure categories and classification helpers. |
| plugins/gemini/scripts/lib/engine.mjs | Adds AGY .exe fail-closed resolution and AGY positional prompt validation/limits. |
| plugins/gemini/scripts/lib/agy-transcript.mjs | Adds structured failure output for transcript recovery outcomes. |
| plugins/gemini/scripts/gemini-mcp.mjs | Implements the MCP JSON-RPC server bridging to existing runtime dispatch/status/result/cancel. |
| plugins/gemini/scripts/gemini-companion.mjs | Adds grouped adversarial dispatch (--engines), group aggregation in status/result, and exports for MCP integration. |
| plugins/gemini/commands/adversarial-review.md | Documents --engines mode and its dispatch rules. |
| plugins/gemini/CHANGELOG.md | Documents MCP server, parallel adversarial review, and AGY 1.1.0 related behavior changes/notes. |
| plugins/gemini/.mcp.json | Declares the MCP server command/args/cwd rooted at ${CLAUDE_PLUGIN_ROOT}. |
| package.json | Updates package metadata (description, repo/homepage/bugs, keywords). |
| docs/MODEL_COMPARISON.md | Clarifies snapshot nature/currentness of probe-derived claims. |
| docs/known-diffs.md | Adds documented intentional divergences + follow-ups for parity campaign. |
| docs/COMPARISON.md | Adds plugin positioning/comparison doc for Gemini vs AGY vs alternatives. |
| docs/adapter-contract.md | Adds adapter contract reference and how this plugin satisfies it by semantic equivalence. |
| .claude-plugin/marketplace.json | Updates marketplace metadata description to reflect Gemini+AGY positioning. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+101
to
105
| const agyBinary = resolveAgyExecutablePath(options); | ||
| const agyStatus = binaryAvailable(agyBinary, ["--version"]); | ||
| if (agyStatus.available) { | ||
| return { engine: "agy", binary: resolveBinaryPath("agy") ?? "agy", version: agyStatus.detail ?? "unknown" }; | ||
| return { engine: "agy", binary: agyBinary, version: agyStatus.detail ?? "unknown" }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the three-plugin parity campaign (gemini-plugin-cc × companion-cx × companion-agy). This branch brings gemini-plugin-cc's share of the union.
Changes
quoteForWindowsShellcannot reliably escape cmd.exe (embedded quotes toggle its parse state). Instead of strengthening it, agy now resolves to an absolute.exe(fail-closed) so its free-text prompt spawnsshell:falseand never traverses cmd.exe — also closes the .cmd-on-unpatched-Node CVE-2024-27980 angle.docs/adapter-contract.md), satisfied by semantic equivalence (no renames — v0.6.6 Hyrum).gemini-mcp.mjs) bridging the existing runtime (zero prompt-assembly duplication), wired via${CLAUDE_PLUGIN_ROOT}with a real spawn launch test.docs/known-diffs.md.Verification
229/229 tests green +
verify-contractspass. Each work package went through Codex implementation → Claude review → independent AGY blind review → fix round. SeeDocuments/Code/outputs/parity-union-2026-07/for the cross-parity matrix and reports.Known limitations
gemini engine e2e is permanently unverifiable (OAuth retired upstream); hooks are native here. See
docs/known-diffs.md.🤖 Generated with Claude Code